package edu.cuit.avatar.inherit;

/**
 * QQ宠物通用类--Pet宠物类
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/9 14:58
 */
public class Pet {
    /**
     * 宠物名称
     */
    private String name;
    /**
     * 健康值
     */
    private int health = 100;
    /**
     * 和主人爱心值(亲密度)
     */
    private int lovely = 100;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public int getLovely() {
        return lovely;
    }

    public void setLovely(int lovely) {
        this.lovely = lovely;
    }

    public void play(){
        if(this.health > 60) {
            this.health -= 5;
            this.lovely += 3;
        }
    }

    /**
     * 吃东西
     */
    public void eat() {
        if(this.health <= 95) {
            this.health += 3;
            this.lovely -= 5;
        }
    }

    /**
     * 宠物基本信息
     */
    public String sayHello(){
        return "我的名字叫" + this.name + ",我的健康值是" + health + ",我和主人的亲密度是" + lovely;
    }

}
